//
//  WCGradientCornerView.m
//  WabbitCode
//
//  Created by William Towe on 2/11/09.
//  Copyright 2009 Revolution Software. All rights reserved.
//

#import "WCGradientCornerView.h"


@implementation WCGradientCornerView
- (void)drawRect:(NSRect)rect {
	static NSColor *bottomLineColor = nil;
	static NSGradient *fillGradient = nil;
	if (!bottomLineColor) {
		bottomLineColor = [[NSColor colorWithCalibratedWhite:101.0/255.0 alpha:1.0] retain];
		fillGradient = [[NSGradient alloc] initWithStartingColor:[NSColor colorWithCalibratedWhite:232.0/255.0 alpha:1.0] endingColor:[NSColor colorWithCalibratedWhite:138.0/255.0 alpha:1.0]];
	}
	
	NSRect inFrame = [self bounds];
	[bottomLineColor setFill];
	NSRectFill(NSMakeRect(inFrame.origin.x, inFrame.origin.y, inFrame.size.width, 1.0));
	
	[fillGradient drawInRect:NSMakeRect(inFrame.origin.x, inFrame.origin.y+1.0, inFrame.size.width, inFrame.size.height-1.0) angle:([self isFlipped])?90.0:-90.0];
}
@end
